package com.beta.cust.bind.datasync.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beta.cust.bind.datasync.constant.BusinessConstant;
import com.beta.cust.bind.datasync.dto.SelectReq;
import com.beta.cust.bind.datasync.mapper.EmployeeInfoMapper;
import com.beta.cust.bind.datasync.mapper.entity.EmployeeInfo;
import com.beta.cust.bind.datasync.service.IEmployeeInfoService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 员工信息表 服务实现类
 * </p>
 *
 * @author pcc
 * @since 2024-03-12
 */
@Service
public class EmployeeInfoServiceImpl extends ServiceImpl<EmployeeInfoMapper, EmployeeInfo> implements IEmployeeInfoService {

    @Override
    public IPage<EmployeeInfo> selectPage(SelectReq req) {
        Page<EmployeeInfo> page = new Page<>(req.getCurrentPage(), req.getPageSize(), false);//不查询总数，提高性能
        return baseMapper.selectPage(page, new LambdaQueryWrapper<EmployeeInfo>()
                .eq(EmployeeInfo::getDelFlag, BusinessConstant.IS_NOT_DEL_FLAG)
                .orderByAsc(EmployeeInfo::getId)
                .gt(null != req.getId(), EmployeeInfo::getId, req.getId()));
    }
}
